import http from '@/server'

/** 获取当前登录用户信息 */
export async function getCurrentUserInfo(userId:string) {
  return http.request({
    url: '/account/info',
    method: 'post',
    data: {userId:userId}
  })
}

export async function getUserList(params: User.UserListParams) {
    return http.request({
      url: '/user/search/full',
      method: 'post',
      headers: {
        'Content-Type': 'application/json', // 设置为 application/json
      },
      data: params, // 使用 data 代替 params，将参数作为请求体传递
    });
}

export async function getFriendsList(params: User.UserListParams) {
    return http.request({
      url: '/friend/get_friend_list',
      method: 'post',
      headers: {
        'Content-Type': 'application/json', // 设置为 application/json
      },
      data: params, 
    });
}

export async function deleteFriend(params: User.UserListParams) {
    return http.request({
      url: '/friend/delete_friend',
      method: 'post',
      headers: {
        'Content-Type': 'application/json', // 设置为 application/json
      },
      data: params, 
    });
}

export async function updateUserInfo(params: User.UserListParams) {
    return http.request({
      url: '/user/update',
      method: 'post',
      headers: {
        'Content-Type': 'application/json', // 设置为 application/json
      },
      data: params, 
    });
}

export async function resetPassword(params: User.UserListParams) {
    return http.request({
      url: '/user/password/reset',
      method: 'post',
      data: params, 
    })
}

export async function addUser(params: User.UserEntity) {
  return http.request({
    url: '/account/add_user',
    method: 'post',
    headers: {
      'Content-Type': 'application/json', 
    },
    data: params, 
  })
}

export async function blockUser(params: User.UserEntity) {
  return http.request({
    url: '/block/add',
    method: 'post',
    headers: {
      'Content-Type': 'application/json', 
    },
    data: params, 
  })
}

export async function forceLogout(params: User.UserEntity) {
  return http.request({
    url: '/auth/force_logout',
    method: 'post',
    headers: {
      'Content-Type': 'application/json', 
    },
    data: params, 
  })
}

export async function getBannedList(params: User.UserEntity) {
  return http.request({
    url: '/block/search',
    method: 'post',
    headers: {
      'Content-Type': 'application/json', 
    },
    data: params, 
  })
}

export async function cancelBanned(params: User.UserEntity) {
  return http.request({
    url: '/block/del',
    method: 'post',
    headers: {
      'Content-Type': 'application/json', 
    },
    data: params, 
  })
}

// export async function editUser(data: Partial<User.UserEntity>) {
//   return http.request({
//     url: `/api/v1/admin/update/${data?.id}`,
//     method: 'post',
//     data
//   })
// }

// export async function delUser(data: Pick<User.UserEntity, 'id'>) {
//   return http.request({
//     url: `/api/v1/admin/delete/${data?.id}`,
//     method: 'post'
//   })
// }
